package org.hbs.blog.code.dao.impl;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

import org.apache.ibatis.session.SqlSessionFactory;
import org.hbs.blog.code.dao.IEssayDao;
import org.hbs.blog.code.entity.Essay;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.stereotype.Repository;

@Repository("essayDao")
public class EssayDao extends SqlSessionDaoSupport implements IEssayDao {
	
	@Resource(name="sqlSessionFactory")
	private SqlSessionFactory sqlSessionFactory;
	
	@PostConstruct
	public void initializeSqlSessionFactory(){
		super.setSqlSessionFactory(sqlSessionFactory);
	}

	public Essay insertEssay(Essay essay) {
		super.getSqlSession().insert("insertEssay", essay);
		return essay;
	}

	public void deleteEssay(String essayID) {
		// TODO Auto-generated method stub
		
	}
}
